<style>
.page-goods-detail .seckill-container .seckill-list2 .fui-list-inner .text.timer span {
    background: #FF4444;
	font-weight:bold;
	font-size:0.7rem;
}
.fe-floatright-bottom .icon {
    display: block;
    width: 1.6rem;
    height: 1.6rem;
    border-radius: 100%;
    color: #fff;
    line-height: 1.6rem;
}
.fui-tab.fui-tab-danger a.active {
    border-color: #FF4444;
}
.label-success {
    background-color: #FF4444;
}
.jylabel-success {
    border: 1px solid #FF4444;
    color: #FF4444;
}
.fee-tag-zi {
    background: linear-gradient(to right,rgba(255,68,68,1),rgba(255,162,162,1));
    color: #fff;
    width: auto;
    font-weight: 400;
    font-size: 0.6rem;
}
.btn.btn-danger-o {
    color: #fff;
    border: 1px solid #fff;
}
</style>
<div class='fui-page fui-page-current'>
	<div class='fui-content member-page'>
			<div class="page-goods-detail" style="margin:0;">
					<div class="memlogo-area" style="background: url({{tomedia(pagedata.team.goods.thumb) ||'../addons/jy_guashop/resource/images/nopic.jpg'}}) no-repeat 50%;background-size: cover;height:10rem;border-radius:0;margin-bottom:0">
						<div class="code" style="margin-top:0;">
							<div class="jylabel jylabel-info" href="javascript:;" ng-click="access_json('jy_guashop/canlog//')" style="border: 1px solid #fff;color:#fff;">我参与的</div>
						</div>
						<span ng-if="pagedata.team.dongimg" class="c" style="position: absolute;left:50%;margin-left:-4.5rem;">
							<img class="icon" style="width:9rem;height:9rem;margin:0 auto" ng-src="{{tomedia(pagedata.team.dongimg)}}"/>
						</span>
					</div>
					<div class="seckill-container" style="background:#e8fcf8">
						<div class="fui-list seckill-list1" style="background:#FF4444;width:70%">
							<div class="fui-list-inner">
								<span class="text bold">￥<span style="font-size:1.5rem">{{pagedata.team.price ||0.00}}</span></span>
							</div>
						</div>
						<div ng-if="pagedata.team.status==1" class="fui-list seckill-list2" style="background:#e8fcf8">
							<div class="fui-list-inner">
								<div class="text bold" style="color:red">{{pagedata.team.statustitle}}</div>
							</div>
						</div>
						<div ng-if="pagedata.team.status!=1" class="fui-list seckill-list2" style="background:#999">
							<div class="fui-list-inner">
								<div class="text bold" style="color:#f2f2f2">{{pagedata.team.statustitle}}</div>
							</div>
						</div>
					</div>
					<div class="detail" style="padding:0.3rem">
						<div class="fui-list-group" style="height:auto;margin-top:0">
							<div class="fui-list jump" style="padding:0.2rem">
								<div class="fui-list-inner" style="border-right: 2px solid #efefef;">
									<div class="name bold">{{pagedata.team.goods.title}}</div>
								</div>
							   <div class="fui-list-media" style="width:3.6rem;text-align:center;padding-left:0.5rem">
									<div class="fui-list-inner">
										<div class="num bold" style="font-size:0.8rem;color:#FF4444">******</div>
										<div class="subtitle">关注人数</div>
								   </div>
							   </div>
							</div>
						</div>
						<div ng-if="pagedata.team.status==1" class="fui-cellone" style="padding:0.3rem 0">
							<div class="fui-cellone-info">
								【全天挂卖中】
							</div>
							<div class="fui-cellone-remark noremark" style="margin-right:0">
								<span ng-click="pagedata.showbuy=true" class="jylabel jylabel-success active" style="border: 1px solid #FF4444;background:#FF4444;padding:0.3rem 0.6rem;border-radius:1rem;font-weight:400">马上速抢</span>
							</div>
						</div>
					</div>
			</div>
			<div style="padding:0.5rem">
			<style>
			.fui-icon-group .fui-icon-col-sm.border {
			   border: 1px solid #FF4444;
			}
			.fui-cellone-icon{color:#FF4444;padding-right:0.5rem;line-height:1.5}
			.fui-icon-group .fui-icon-col-sm .icon{font-size:1.5rem;line-height:1.5}
			</style>
			<div class="fui-tab fui-tab-danger">
				<a class="external active" href="javascript:" ng-click="pagedata.showcanlog=0;">挂卖详情</a>
			</div>
			<!--商品详情开始-->
			<div  class="detail-block" style="position: relative;margin-top:0.5rem;border-radius: 0.5rem;width:100%;background:#fff;padding-bottom:0">
					<div ng-if="pagedata.goods.param.length>0" style="padding:0.4rem 0.5rem;padding-top:0">
						 <div class="fui-cell-group notop" style="background:#f2f2f2;margin-bottom:0.4rem">
							<div ng-repeat="p in pagedata.goods.param" class="fui-cell" style="padding:0.5rem">
								<div class="fui-cell-label md" style="color:#666">{{p.title}}</div>
								<div class="fui-cell-info  md" style="color:#333">{{p.value}}</div>
							</div>
						</div>
					</div>
					<div class="content-block content-images" style="padding:0.5rem" ng-bind-html="trust(pagedata.team.goods.goodsdetail)"></div>
			</div>
	</div>
</div>
<div ng-if="pagedata.showbuy" class="popup">
	<div class="popup-body">
		<div class="popup-bottom" style="background:#FF4444">
			<style>
				.fui-cellone .fui-cellone-info {
					font-size: 0.85rem;
				}
			</style>
			<i class="closed icon icon-cuowu" ng-click="pagedata.showbuy=false"></i>
			 <div class='fui-cell-group-o' style="margin:0.5rem;padding-top:0.5rem;background:#FF4444">
				<div class='fui-cell-title c' style="color:#fff;padding-bottom:0.3rem">您正在进行“商品购买”操作</div>
				<div class='fui-cell-title c' style="color:#f2f2f2;font-size:0.6rem;padding:0">(商品购买单价{{pagedata.team.price||0}}元)</div>
				<div ng-if="pagedata.team.goodstype!=1">
				<div class="fui-cellone" style="padding-top:0">
					<div class="fui-cellone-label bold" style="color:#fff;width:auto;padding-right:0.5rem">配送地址</div>
				</div>
				<div ng-if="pagedata.post.address" class="fui-cellone" style="padding-top:0">
					<div class="fui-cellone-info">
						<div class="title" style="color:#fff;font-size:0.65rem"><span class='realname'>{{pagedata.post.address.name}}</span> <span class='mobile'>{{pagedata.post.address.mobile}}</span></div>
						<div class="text" style="color:#fff;font-size:0.65rem"><span class='address'>{{pagedata.post.address.pcd.province}}&nbsp{{pagedata.post.address.pcd.city}}&nbsp{{pagedata.post.address.pcd.district}}&nbsp{{pagedata.post.address.pcd.street}}&nbsp{{pagedata.post.address.address}}</span></div>
					</div>
					<div class="fui-cellone-remark" ng-click="pagedata.get_addresslist();">
						编辑
					</div>
				</div>
				<div ng-if="!pagedata.post.address" class="c">
					<div ng-click="pagedata.edit_address=1" class='btn btn-sm btn-danger-o external' style="border-radius: 100px;width:  7rem;font-size: .75rem"><i class="icon icon-tianjia"></i> 添加配送地址</div>
				</div>
				<div class="gray" style="padding:0 0.5rem;font-size:0.65rem;">备注：下单后，将按本地址配送商品！</div>
				</div>
				<div class="fui-cellone" style="padding:0.2rem 0.6rem">
					<div class="fui-cellone-icon" style=''>
					<input type="checkbox" ng-checked="pagedata.post.checked==true" ng-model="pagedata.post.checked" name="checkbox" class="fui-radio fui-radio-danger cartmode check-item"/>
					</div>
					<div class="fui-cellone-text" style='line-height:1.2;font-size:0.7rem'>
						<div style="font-size:0.65rem;color:#f2f2f2" ng-click="pagedata.show_xieyi=true;">查看《挂卖商城协议》 <i class="icon icon-tishi" style="font-size:0.65rem"></i></div>
					</div>
				</div>
			</div>
			<div class="weui_btn_area" style="margin:1rem 2rem;">
				<div class="c" style="font-size:0.6rem;margin-top:-0.3rem;color:#f2f2f2">
					实付总金额：{{pagedata.team.price||0}}元	
				</div>
				<a class='weui_btn weui_btn_primary' style="border-radius:1rem;background-color:#fff;color:#FF4444" ng-click="pagedata.topost()">确认支付</a>
			</div>
		</div>
	</div>
</div>
<div ng-if="pagedata.modal_address==1" class="popup">
	<div class="popup-body">
		<div class="popup-bottom" style="padding-bottom:2.5rem">
		<i class="closed icon icon-close" style="color:red;top:0.3rem" ng-click="pagedata.modal_address=0"></i>
		<div class="fui-list-group modal-swiper-y" style='margin-top:5px;background:#fff;'>
			<div class="fui-list address-item" ng-repeat="item in pagedata.address_list">
				<div class="fui-list-inner">
					<div class="title" ng-click="pagedata.change_address(item)"><span class='realname'>{{item.name}}</span> <span class='mobile'>{{item.mobile}}</span></div>
					<div class="text" ng-click="pagedata.change_address(item)"><span class='address'>{{item.pcd.province}} {{item.pcd.city}} {{item.pcd.district}} {{item.address}}</span></div>
					<div class='bar' style="line-height:1.4">
						<span class='pull-right'>
							<a class="external" href="javascript:;" ng-click="pagedata.edit_address=1;pagedata.nowaddress=item;pagedata.isaddaddress=0">
							<i class='icon icon-bianji'></i> 编辑
							</a>
							<a class='external' href="javascript:;" ng-click="pagedata.del_address($index)">
							<i class='icon icon-shanchu'></i> 删除
							</a>
						</span>
						<label class='radio-inline'  ng-click="pagedata.setaddress($index);pagedata.change_address(item)">
							<input type="radio" class="fui-radio  fui-radio-danger" ng-checked="item.isdefault==1"/> 设置默认
						</label>
					</div>
				</div>
			</div>
			<div ng-if="!pagedata.address_list || pagedata.address_list.length<1" class='content-empty' style="margin-top:0">
						<i class='icon icon-map' style="font-size:2rem"></i>
						<div style="padding-bottom:0.5rem">目前没有合适的地址！</div>
			</div>
		</div>
		<div class='fui-navbar'>
			<a class="nav-item btn btn-danger external" ng-click="pagedata.edit_address=1;pagedata.post.address.address='';pagedata.isaddaddress=1"><i class="icon icon-tianjia" style="font-size:0.8rem"></i> 添加地址</a>
		</div>
		</div>
	</div>
</div>
<div ng-if="pagedata.edit_address==1" class="popup">
	<div class="popup-body">
		<div class="popup-center">
			<div class='fui-cell-group modal-swiper-y' style="border-radius: 0.5rem;margin-top:0;height:auto;max-height:20rem;padding-bottom:2.5rem">
				<div class="fui-cell">
					<div class="fui-cell-label" style="width:100px;font-size:0.8rem">编辑地址</div>
					<div class='fui-cell-info'></div>
					<div class="fui-cell-remark" ng-if="pagedata.openid && pagedata.isaddaddress==1"><span ng-click="pagedata.openAddress()">添加微信地址</span></div>
				</div>
                <div class='fui-cell'>
                    <div class='fui-cell-label'>收件人</div>
                    <div class='fui-cell-info'><input type="text" ng-model="pagedata.nowaddress.name" placeholder="收件人" class="fui-input"/></div>
                </div>
                <div class='fui-cell'>
                    <div class='fui-cell-label'>联系电话</div>
                    <div class='fui-cell-info'><input type="tel" ng-model="pagedata.nowaddress.mobile" placeholder="联系电话"  class="fui-input"/></div>
                </div>
                <div class="fui-cell">
					<div class="fui-cell-label ">地区</div>
					<div class="fui-cell-label" style="width:28%">
						<select ng-model="pagedata.nowaddress.pcd.province" class="form-control tpl-province">
						<option value="" selected="selected">省份</option>
						<option ng-repeat="(value,data) in pagedata.province" value="{{value}}" ng-selected="pagedata.nowaddress.pcd.province==value">{{value}}</option>
						</select>
					</div>
					<div class="fui-cell-label" style="width:28%">
						<select ng-model="pagedata.nowaddress.pcd.city" class="form-control tpl-city">
						<option value="" selected="selected">城市</option>
						<option ng-repeat="(value,data) in pagedata.province[pagedata.nowaddress.pcd.province]" value="{{value}}" ng-selected="pagedata.nowaddress.pcd.city==value">{{value}}</option>
						</select>
					</div>
					<div class="fui-cell-label" style="width:28%">
						<select ng-model="pagedata.nowaddress.pcd.district" class="form-control tpl-district">
						<option value="" selected="selected">区县</option>
						<option ng-repeat="(value,data) in pagedata.province[pagedata.nowaddress.pcd.province][pagedata.nowaddress.pcd.city]" value="{{value}}" ng-selected="pagedata.nowaddress.pcd.district==value">{{value}}</option>
						</select>
					</div>
					<div class="fui-cell-label" style="width:28%">
						<select ng-model="pagedata.nowaddress.pcd.street" class="form-control tpl-district">
						<option value="" selected="selected">街道</option>
						<option ng-repeat="value in pagedata.province[pagedata.nowaddress.pcd.province][pagedata.nowaddress.pcd.city][pagedata.nowaddress.pcd.district]" value="{{value}}" ng-selected="pagedata.nowaddress.pcd.street==value">{{value}}</option>
						</select>
					</div>
				</div>
                <div class='fui-cell'>
                    <div class='fui-cell-label'>详细地址</div>
                    <div class='fui-cell-info'><input type="text" ng-model="pagedata.nowaddress.address" placeholder='街道，楼牌号等'  class="fui-input"/></div>
                </div>
            </div>
			<div class="fui-navbar">
				<a href="javascript:;" ng-click="pagedata.add_address();" class="nav-item btn btn-danger confirmbtn">确定</a>
			</div>
			<i ng-click="pagedata.edit_address=0" class="closed icon icon-cuowu"></i>
		</div>
	</div>
</div>
<div ng-if="pagedata.show_xieyi" class="popup">
	<div class="popup-body">
		<div class="popup-center">
			<i class="closed icon icon-cuowu" style="font-size:1.2rem;top:105%;" ng-click="pagedata.show_xieyi=false"></i>
			<div class="content-images" style="padding:0.5rem;height:20rem; overflow-y:scroll;">
					<div class="title bold" style="font-size:0.8rem">挂卖协议 / <small>Read Ggree</small></div>
					<div class="text" style="padding-top:0.5rem;font-size:0.7rem" ng-bind-html="trust(pagedata.pluginset.xieyi)">
					</div>
			</div>
			<div class="modal-footer">
				<div ng-click="pagedata.show_xieyi=false;pagedata.post.checked=1" class="mod-check" style="width: 100%; margin: 0;">我已阅读</div>
			</div>
		</div>
	</div>
</div>
<div ng-include="sys_html('_footer')"></div>
<script>
scope.pagedata.nowaddress=scope.pagedata.nowaddress?scope.pagedata.nowaddress:{}
scope.pagedata.geturl='jy_guashop/detail/getlist/'
scope.tool.get_list(scope.pagedata.geturl,true);
scope.pagedata.scroll_bottom=function(){
	scope.tool.get_list(scope.pagedata.geturl);
}
scope.pagedata.upjifen2=function(){
	var num=scope.pagedata.post.yue_buynum*scope.pagedata.post.yue_days;
	num=num?num:0;
	scope.pagedata.post.goodsfee=scope.pagedata.team.price*num
	var yue_fee=scope.pagedata.pluginset.yue_fee?scope.pagedata.pluginset.yue_fee:0;
	scope.pagedata.post.yue_fee=yue_fee*num;
	var yue_quan=scope.pagedata.pluginset.yue_quan?scope.pagedata.pluginset.yue_quan:0;
	scope.pagedata.post.yue_quan=yue_quan*num;
	scope.$evalAsync();
}
scope.pagedata.topost=function(isyue){
	isyue=isyue?isyue:0;
	if(scope.pagedata.post.checked!=1){
		scope.message('请先阅读《挂卖协议》！','error');
		return false;
	}
	scope.post_json('/detail/post/',scope.pagedata.post,function(result){
		scope.pagedata.order_id=result.order_id;
		var success_url=result.success_url
		var error_url=result.error_url
		scope.$evalAsync();
		scope.tool.pay(result.pay_id,function(res){
				if(res.type=='success'){
					scope.message('参与成功！','success',success_url);
				}else{
					scope.message('参与失败！','success',error_url);
				}
		},'','',success_url,error_url);
	});
}
scope.pagedata.openAddress=function (){
	wx.openAddress({
		  success: function (res) {
			scope.pagedata.post.address={}
			scope.pagedata.post.address.name = res.userName; // 收货人姓名
			scope.pagedata.post.address.pcd={}
			scope.pagedata.post.address.pcd.province = res.provinceName; // 国标收货地址第一级地址（省）
			scope.pagedata.post.address.pcd.city = res.cityName; // 国标收货地址第二级地址（市）
			scope.pagedata.post.address.pcd.district = res.countryName; // 国标收货地址第三级地址（国家）
			scope.pagedata.post.address.address = res.detailInfo; // 详细收货地址信息
			scope.pagedata.post.address.mobile = res.telNumber; // 收货人手机号码
			scope.$evalAsync();
		  },
		  fail: function (res) {
			console.log('fail');console.log(res)
		  }
	});
}
scope.pagedata.setaddress=function(index){
	var id =scope.pagedata.address_list[index].id
	scope.get('core/member.address/set/id='+id+'&get=1',function(res){
		for(var i in scope.pagedata.address_list){
				scope.pagedata.address_list[i].isdefault=0
		}
		scope.pagedata.address_list[index].isdefault=1
		scope.pagedata.post.addressid=id
		scope.pagedata.modal_address=0;
		scope.message('设置成功');
		scope.$evalAsync();
	});
}
scope.pagedata.del_address=function(index){
	var id =scope.pagedata.address_list[index].id
	scope.get('core/member.address/del/id='+id+'&get=1',function(res){
		scope.pagedata.address_list.splice(index,1);
		scope.message('删除成功');
		scope.$evalAsync();
	});
}
scope.pagedata.get_addresslist=function(){
	scope.pagedata.nowaddress.res=1
	scope.get('jy_weishop/get_data/get_addresslist/',function(res){
		scope.pagedata.address_list=res.list;
		scope.pagedata.modal_address=1;
		scope.$evalAsync();	
	});
}
scope.pagedata.add_address=function(){
	scope.pagedata.nowaddress.res=1
	if(scope.pagedata.isaddaddress==1){
		scope.pagedata.nowaddress.id=0;
	}
	scope.pagedata.post.address=scope.pagedata.nowaddress;
	scope.post_json('core/member.address/post/',scope.pagedata.nowaddress,function(res){
		scope.pagedata.edit_address=0;
		scope.pagedata.modal_address=0;
		scope.$evalAsync();	
	});
}
scope.pagedata.change_address=function(res){
	scope.pagedata.post.address=res;
	scope.pagedata.post.addressid=res.id;
	scope.pagedata.modal_address=0;
}
scope.pagedata.getprovince=function(){
	scope.get('jy_weishop/get_data/getprovince/',function(res){
		scope.pagedata.province=res.province;
		scope.$evalAsync();
	});
}
scope.pagedata.getprovince();
</script>